package com.kd.juhaowan.sdk;

import android.app.Application;
import android.widget.Toast;

import com.kedou.sdk.JuHaoWanSDK;
import com.kedou.sdk.JuHaoWanSDKCallback;
import com.kedou.sdk.JuHaoWanSDKConfiguration;
import com.kedou.sdk.assist.Constant;


/**
 * Created by Administrator on 2017/6/2 0002.
 */

public class DemoApplication extends Application {

    @Override
    public void onCreate() {
        super.onCreate();
        this.getApplicationContext();
        JuHaoWanSDKConfiguration.Builder builder = new JuHaoWanSDKConfiguration.Builder(this);
//        builder.setGameId("25");
        builder.setGameId("D9vKpbwLWnHJedEzfRxF0PGmQT51SY7r");
//        builder.setGameId("143");
        builder.setToutiaoId("608675");
        builder.setShowQuickRegisterEnabled(true);
        JuHaoWanSDK.getInstance().init(builder.build(), new JuHaoWanSDKCallback(){

            @Override
            public void onWanSDKResponse(int stateCode, String message, String jsonObject) {
                switch (stateCode){
                    case Constant.InitState.INIT_SUCCESS:
                        Toast.makeText(getApplicationContext(), "init success", Toast.LENGTH_LONG).show();

                        break;

                    case Constant.InitState.INIT_FAILED:
                    default:
                        Toast.makeText(getApplicationContext(), "init failed", Toast.LENGTH_LONG).show();
                        break;

                }
            }

            @Override
            public void onWanSDKException(Exception ex) {
                Toast.makeText(getApplicationContext(), "init exception", Toast.LENGTH_LONG).show();
            }
        });
    }

    @Override
    public void onTerminate() { 
        super.onTerminate();
        JuHaoWanSDK.getInstance().destroy();
    }

}
